{extend name='layout/base' /}
{block name='title'}添加照片信息{/block}
{block name='contentHeader'}
{/block}
{block name='content'}
<script src="__PLUGIN__/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
<link rel="stylesheet" href="__PLUGIN__/bootstrapvalidator/css/bootstrapValidator.min.css">
<!-- Horizontal Form -->
<div class="box box-info" style="width:90%;margin: 0 auto;">
    <div class="box-header with-border">
        <h3 class="box-title">照片信息</h3>
    </div>
    <!-- /.box-header -->
    <!-- form start -->
    <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
        <div class="box-body">
            {if condition = "$Think.Session.role_id == 101"}
            <div class="form-group">
                <label class="col-sm-2 control-label">照片类型</label>
                <div class="col-sm-10">
                    {volist name='types' id='type'}
                    <div class="radio">
                        <label>
                            <input type="radio" class="minimal" name="type" value="{$type}">
                            {$type}
                        </label>
                    </div>
                    {/volist}
                </div>
            </div>
            {/if}
            <div class="form-group">
                <label for="pic_info" class="col-sm-2 control-label">照片说明</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="pic_info" name="pic_info" placeholder="照片说明">
                </div>
            </div>
            <div class="form-group">
                <label for="picture" class="col-sm-2 control-label">上传照片</label>
                <div class="col-sm-10">
                    <input id="picture" name="picture" type="file" accept="image/*"/>
                </div>
            </div>
        </div>
        <!-- /.box-body -->
        <div class="box-footer">
            <input type="hidden" name="__token__" value="{$Request.token}" />
            <input type="hidden" name="admin_id" value="{$id}" />
            <button type="reset" class="btn btn-default">重置</button>
            <button type="submit" class="btn btn-info pull-right">提交</button>
        </div>
        <!-- /.box-footer -->
    </form>
</div>
<script type="text/javascript">
    //jQuery代码
    $(function () {
        $('form').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                // pic_info: {
                //     validators: {
                //         notEmpty: {
                //             message: '照片说明必须'
                //         }
                //     }
                // },
                {if condition = "$Think.Session.role_id == 101"}
                type: {
                    validators: {
                        notEmpty: {
                            message: '照片类型必须'
                        }
                    }
                },
                {/if}
                picture: {
                    validators: {
                        notEmpty: {
                            message: '照片必须'
                        }
                    }
                }
            }
        });
    });
</script>
{/block}